<div class="ibox">
    <div class="ibox-content table-responsive">
        <div class="row">
            <form id="pagerForm" method="post" class="form-inline searchForm">
                <input type="hidden" name="main_table" id="main_table" value="{$info.main_table}">
                <input type="hidden" name="ext_table" id="ext_table" value="{$info.ext_table}">
                <div class="col-sm-3 m-b-xs">
                    <lqf_link><a class="btn btn-info ajax-open"
                                 data-url="{:url('WorkflowDiyField/add',array('diy_form_id'=>$diy_form_id))}"
                                 data-title="添加字段"><i class="fa fa-plus"></i>添加</a></lqf_link>
                </div>
                <div class="col-sm-9 m-b-xs text-right">
                    <div class="input-group">
                        <input type="text" name="keywords" placeholder="输入关键字搜索"
                               class="form-control">
                    </div>
                    <div class="input-group">
                                    <span class="input-group-btn"> <button type="button"
                                                                           class="btn btn-primary ajaxSearchForm"><i
                                            class="fa fa-search"></i> 搜索</button></span>
                    </div>
                </div>
            </form>
        </div>
        <table class="table table-hover sorttable ajax-list-table"
               data-url="{:url('WorkflowDiyField/show_json',array('diy_form_id'=>$diy_form_id))}" width="100%">
            <thead>
            <tr>
                <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="120">显示名称</th>
                <th width="100">字段名称</th>
                <th width="100">类型</th>
                <th width="80">最大值</th>
                <th width="80">默认值</th>
                <th width="80">配置项</th>
                <th width="80" class="text-center">是否必填</th>
                <th width="80" class="text-center">列表显示</th>
                <th width="80" class="text-center">是否启用</th>
                <th width="80" orderField="by_sort" class="sort-filed"><span>排序</span></th>
                <th width="80" class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            </tbody>
            <tfoot class="ibox-content">
            <tr>
                <td colspan="11" align="center"></td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>

<script id="tableListTpl" type="text/html">
    <% for(var i=0;i<data.length;i++) {
        var visible=(data[i]['visible']=='1')?'checked':false;
        var is_require=(data[i]['is_require']=='1')?'checked':false;
        var is_list=(data[i]['is_list']=='1')?'checked':false;
        var is_search=(data[i]['is_search']=='1')?'checked':false;
        var is_form=(data[i]['is_form']=='1')?'checked':false;
    %>
    <tr>
        <td><input name="field_ext_id" class="checkboxCtrlId" value="<%=data[i]['field_ext_id']%>" type="checkbox"></td>
        <td>
            <input type="text" name="show_name"  value="<%=data[i]['show_name']%>" class="form-control ajax-field" data-url="{:url('WorkflowDiyField/set_field',array('name'=>'show_name'))}" data-id="<%=data[i]['id']%>" size="10">
        </td>
        <td><%=data[i]['field_name']%></td>
        <td><%=data[i]['field_type_text']['name']%></td>
        <td><%=data[i]['max_length']%></td>
        <td><%=data[i]['field_default']%></td>
        <td><%=data[i]['field_option']%></td>
        <td class="text-center">
            <%if(data[i]['is_require_set']==1){%>
            <input name="is_require" class="ajax-checkbox" type="checkbox"   data-url="{:url('WorkflowDiyField/set_visible',array('name'=>'is_require'))}"  data-id="<%=data[i]['id']%>" <%=is_require%> >
            <%}else{%>
            -
            <%}%>
        </td>
        <td class="text-center">
            <%if(data[i]['is_list_set']==1){%>
            <input name="is_list" class="ajax-checkbox" type="checkbox"   data-url="{:url('WorkflowDiyField/set_visible',array('name'=>'is_list'))}"  data-id="<%=data[i]['id']%>" <%=is_list%> >
            <%}else{%>
            -
            <%}%>
        </td>
        <td class="text-center">
            <%if(data[i]['is_system']==1){%>
            <input name="visible" class="ajax-checkbox" type="checkbox"   data-url="{:url('WorkflowDiyField/set_visible',array('name'=>'visible'))}"  data-id="<%=data[i]['id']%>" <%=visible%> >
            <%}else{%>
            -
            <%}%>
        </td>
        <td>
            <input type="text" name="sort" value="<%=data[i]['sort']%>" class="form-control w50 ajax-sort" data-url="{:url('WorkflowDiyField/set_sort',array('name'=>'sort'))}" data-id="<%=data[i]['id']%>" size="5">
        </td>
        <td class="text-center">
            <lqf_link><a class="ajax-open" data-url="{:url('WorkflowDiyField/edit')}"  data-ids="{'id':'<%=data[i]['id']%>'}" data-title="修改">修改</a></lqf_link>
            <%if(data[i]['is_del']==1){%>
            <lqf_link><a class="ajax-del confirm" data-url="{:url('WorkflowDiyField/del')}" data-ids="{'id':'<%=data[i]['id']%>'}">删除</a></lqf_link>
            <%}else{%>
            <%}%>
        </td>
    </tr>
    <% } %>
</script>
<script type="text/javascript">
    $(document).ready(function () {
        turnPage(1);//页面加载时初始化分页
    });
</script>
